import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:json_theme/json_theme.dart';

class AppTheme {
  static final shared = AppTheme._();
  AppTheme._();

  late final ThemeData currentTheme;

  Future<void> init() async {
    final themeString =
        await rootBundle.loadString('assets/jsons/advanced_theme.json');
    final themeJson = json.decode(themeString);
    currentTheme =
        ThemeDecoder.decodeThemeData(themeJson, validate: true) ?? ThemeData();
  }
}
